package org.java.log;

import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 测试slf4j+log4j的用法
 * Created by Dwyane-Wevil on 2016/12/18.
 */
public class Slf4j2log4jTest {

    final Logger logger = LoggerFactory.getLogger(Slf4j2log4jTest.class);
    private static String config = System.getProperty("user.dir") + "\\src\\resource\\log4j.properties";

    public static void main(String[] args) {
        // 测试slf4j用法
        Slf4j2log4jTest t1 = new Slf4j2log4jTest();
        t1.setTemperature();
    }

    public void setTemperature() {
        // 这是log4j读取配置文件方式。
        PropertyConfigurator.configure(config);

        logger.error("Slf4j-log4j : error");
        logger.info("Slf4j-log4j : info");
    }
}
